1 using UnityEngine;
2 using
System.Collections;
3
4 public
class NextShopButtonListener : InputAdapter {
5
6     
public GameObject shopLayer;
7     
public GameObject pickSkillLayer;
8
9     
public void Start () {
10         gameObject.AddComponent<Actor>().addAction(
new ActionRepeat(ActionRepeat.FOREVER, new ActionSequence(
11             
new ActionScaleTo(0.95f, 0.95f, 0.2f, Interpolation.sine),
12             
new ActionScaleTo(1, 1, 0.2f, Interpolation.sine)
13             )));
14     }
15
16     
public override void OnTouchDown()
17     {
18         
if (InputController.Name != InputNames.SHOP) return;
19         
base.OnTouchDown();
20         gameObject.GetComponent<SpriteRenderer>().color =
new Color(0.5f, 0.5f, 0.5f, 1);
21         SoundManager.playButtonSound();
22     }
23     
public override void OnCheckUp()
24     {
25         
if (InputController.Name != InputNames.SHOP) return;
26         
base.OnCheckUp();
27         gameObject.GetComponent<SpriteRenderer>().color =
new Color(1, 1, 1, 1);
28     }
29     
public override void OnTouchUp()
30     {
31         
if (InputController.Name != InputNames.SHOP) return;
32         
base.OnTouchUp();
33         
if (shopLayer.GetComponent<Actor>() != null)
34             Destroy(shopLayer.GetComponent<Actor>());
35         shopLayer.AddComponent<Actor>().addAction(
new ActionSequence(new ActionMoveTo(-8, 0, 0.3f), new ActionRunnable(delegate() { shopLayer.SetActive(false); })));
36
37         pickSkillLayer.SetActive(
true);
38         
if (pickSkillLayer.GetComponent<Actor>() != null)
39             Destroy(pickSkillLayer.GetComponent<Actor>());
40         pickSkillLayer.AddComponent<Actor>().addAction(
new ActionMoveTo(0, 0, 0.3f));
41     }
42 }



Trò chơi đua xe động vật trong UNITY Engine 114.929 lượt xem

Gõ tìm kiếm nhanh...